part of '../basic.dart';

extension DirectoryExtension on Directory {
  /// 快速获取文件夹的名字
  String get name => path.split("/").last;

  /// 获取文件夹下的所有子文件夹
  List<Directory> get subFolders {
    List<Directory> output = [];
    for (final child in listSync()) {
      if (child is Directory) output.add(child);
    }
    return output;
  }

  /// 获取文件夹下的所有子文件
  List<File> get subFiles {
    List<File> output = [];
    for (final child in listSync()) {
      if (child is File) output.add(child);
    }
    return output;
  }
}
